import type { ApiResponse, BaseRecordSearchWrapper, BaseRecordVo, TableQuery } from '@/types/basetypes';
import type { StaffForm } from '@/types/employess/staff/types';
import type { TableConfigrationType } from '@/types/table-configtypes';
import type { QueryWrapper, UpdateWrapper } from '@/types/wrappertypes';
import request from '@/utils/request'

//查询员工列表信息
export function _getStaffList(params: object) {
  return request({
    url: '/staff/query-all',
    method: 'GET',
    params: params,
  });
}
//查询员工信息
export const _getStaffInfo = async (params: { id: string }): Promise<ApiResponse<StaffForm>> => {
  const { id } = params;
  return request({
    url: `/staff/query-details/${id}`,
    method: 'GET',
  });
}
//保存员工信息
export const _saveStaffInfo = async (params: object): Promise<ApiResponse<void>> => {
  return request({
    url: '/staff/insert',
    method: 'POST',
    data: params,
  });
}
//更新员工信息
export const _modifyStaffInfo = async (params: UpdateWrapper): Promise<ApiResponse<void>> => {
  return request({
    url: '/staff/modify',
    method: 'POST',
    data: params,
  });
}
//删除员工信息
export const _delStaffInfoByIds = async (ids: string): Promise<ApiResponse<void>> => {
  return request({
    url: '/staff/del-ids',
    method: 'POST',
    data: { ids: ids },
  });
}
//查询员工操作记录
export const _getRecordInfos = async (params: { id: string }): Promise<ApiResponse<BaseRecordVo[]>> => {
  const { id } = params;
  return request({
    url: `/staff/query-details-record/${id}`,
    method: 'GET',
  });
}
//新增备注
export const _saveRecordRemarkInfos = async (params: { bizId: string, remark: string }): Promise<ApiResponse<void>> => {
  return request({
    url: '/staff/insert-remark',
    method: 'POST',
    data: params,
  });
}
//搜索操作记录
export const _searchRecordRemarkInfos = async (params: BaseRecordSearchWrapper): Promise<ApiResponse<BaseRecordVo[]>> => {
  return request({
    url: '/staff/query-details-record-wrapper',
    method: 'POST',
    data: params,
  });
}
//查询员工列表select配置数据
export const _getStaffTableConfigeration = async (): Promise<ApiResponse<TableConfigrationType>> => {
  return request({
    url: `/staff/query-table-config`,
    method: 'GET',
  });
}
//查询员工列表操作数据
export const _getStaffTableList = async (params: QueryWrapper): Promise<ApiResponse<TableQuery<StaffForm>>> => {
  return request({
    url: `/staff/query-table-list`,
    method: 'POST',
    data: params
  });
}

